function resolved(result) {
    console.log('Resolved');
}

function rejected(result) {
    console.error(result);
}

Promise.resolve(new Error('success')).then(resolved, rejected);
Promise.reject(new Error('fail')).then(resolved, rejected);
